<template>
  <CategorySelector :disabled="isShow !== 1" />
  <SpuList v-if="isShow === 1" @setIsShow="isShow = $event" @setSpu="spu = $event" />
  <SaveOrUpdateSpu v-if="isShow === 2" @setIsShow="isShow = $event" :currentSpu="spu" />
</template>
<script lang="ts" setup>
  import { ref, reactive } from 'vue';
  import { SpuItem } from '/@/api/product/model/spuModel';
  import SpuList from './components/SpuList.vue';
  import SaveOrUpdateSpu from './components/SaveOrUpdateSpu.vue';

  /*
    1 显示 SpuList
    2 显示 SaveOrUpdateSpu
  */
  const isShow = ref<number>(1);
  const spu = reactive<SpuItem>({
    spuName: '',
    description: '',
    tmId: undefined,
    spuSaleAttrList: [],
    spuImageList: [],
  });
</script>
